<?php

namespace App\Http\Requests\Backend;

use Illuminate\Foundation\Http\FormRequest;

class RoleRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'name' => 'required',
            'guard_name' => 'required',
        ];

        return $rules;
    }

    public function messages()
    {
        return [
            'name.required' => '请输入角色名',
            'guard_name.required' => '请选择所属模块',
        ];
    }

    public function filldata()
    {
        $data = [
            'name' => $this->input('name'),
            'guard_name' => $this->input('guard_name'),
        ];


        return $data;
    }
}
